package com.weixin.common.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;

@Data
@Schema(name = "统一数据返回对象", description = "所有数据经此包装")
public class ResponseResult<T> implements Serializable {

    private int code;

    private String message;
    private String type;

    private T result;

    public ResponseResult(int code, String msg, T data) {
        this.code = code;
        this.type = code == 200 ? "success" : "error";
        this.message = msg;
        this.result = data;
    }
}
